package cn.tedu.submarine;

import javax.swing.*;

/** 战舰:是海洋对象 */
public class Battleship extends SeaObject {

    private int life;//命

    public Battleship(){
        super(66,26,270,124,20);
        life = 5;
    }
    /** 重写move移动    */
    public void move(){
       //搁置
    }
/** 重写getImage（）获取对象图片*/
    public  ImageIcon getImage(){
        return Images.battleship;
    }
    /**生成深水炸弹*/
    public Bomb nextBomb(){
        return new Bomb(this.x,this.y);//炸弹的xy就是战舰的xy
    }
    public void moveLeft(){
        x-=speed;//x-（左移）
    }
    public void moveRight(){
        x+=speed;//x+()右移
    }
    public void addLife(int num){
        life+=num;//命数增num
    }
    public int getLife(){
        return life;
    }
    public void subtractiLife(){
        life-=1;

    }


}
